package abstractEntities;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;
import org.hibernate.annotations.GenericGenerator;

import entities.Course;
import entities.Languagelesson;
import entities.Lessonstudent;

/**
 * AbstractLesson entity provides the base persistence definition of the Lesson
 * entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractLesson implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 9131226799852181856L;
	private Integer idLesson;
	private Course course;
	private Set<Languagelesson> languagelessons = new HashSet<Languagelesson>(0);
	private Set<Lessonstudent> lessonstudents = new HashSet<Lessonstudent>(0);

	// Constructors

	/** default constructor */
	public AbstractLesson() {
	}

	/** minimal constructor */
	public AbstractLesson(Course course) {
		this.course = course;
	}

	/** full constructor */
	public AbstractLesson(Course course, Set<Languagelesson> languagelessons,
			Set<Lessonstudent> lessonstudents) {
		this.course = course;
		this.languagelessons = languagelessons;
		this.lessonstudents = lessonstudents;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "idLesson", unique = true, nullable = false)
	public Integer getIdLesson() {
		return this.idLesson;
	}

	public void setIdLesson(Integer idLesson) {
		this.idLesson = idLesson;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idCourse", nullable = false)
	public Course getCourse() {
		return this.course;
	}

	public void setCourse(Course course) {
		this.course = course;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "lesson")
	public Set<Languagelesson> getLanguagelessons() {
		return this.languagelessons;
	}

	public void setLanguagelessons(Set<Languagelesson> languagelessons) {
		this.languagelessons = languagelessons;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "lesson")
	public Set<Lessonstudent> getLessonstudents() {
		return this.lessonstudents;
	}

	public void setLessonstudents(Set<Lessonstudent> lessonstudents) {
		this.lessonstudents = lessonstudents;
	}

}